


#ifndef PF_UNITS_H
#define PF_UNITS_H

#include "lx_define.h"
#include "pf_vector.h"
#include "lx_Export.h"
/**
 * Conversion methods for units
 *

 */
class LX_EXPORT PF_Units {
public:

    //static char* unit2sign(LX_Define::Unit unit);

    //static LX_Define::Unit string2unit(const char* str, bool* ok=0);
    //static char* unit2string(LX_Define::Unit unit);

    static LX_Define::Unit dxfint2unit(int dxfint);

    static QString unitToString(LX_Define::Unit u, bool t = true);
    static LX_Define::Unit stringToUnit(const QString& u);

	static bool isMetric(LX_Define::Unit u);
	static double getFactorToMM(LX_Define::Unit u);
	static double convert(double val, LX_Define::Unit src, LX_Define::Unit dest);
	static PF_Vector convert(const PF_Vector val, LX_Define::Unit src, LX_Define::Unit dest);
	
    static QString unitToSign(LX_Define::Unit u);

    static QString formatLinear(double length, LX_Define::Unit unit,
                                  LX_Define::LinearFormat format,
                                  int prec, bool showUnit=false);
    static QString formatScientific(double length, LX_Define::Unit unit,
                                  int prec, bool showUnit=false);
    static QString formatDecimal(double length, LX_Define::Unit unit,
                                  int prec, bool showUnit=false);
    static QString formatEngineering(double length, LX_Define::Unit unit,
                                  int prec, bool showUnit=false);
    static QString formatArchitectural(double length, LX_Define::Unit unit,
                                  int prec, bool showUnit=false);
    static QString formatFractional(double length, LX_Define::Unit unit,
                                  int prec, bool showUnit=false);

    static QString formatAngle(double angle, LX_Define::AngleFormat format,
                                 int prec);

	static PF_Vector paperFormatToSize(LX_Define::PaperFormat p);
	static LX_Define::PaperFormat paperSizeToFormat(const PF_Vector s);
	
        static QString paperFormatToString(LX_Define::PaperFormat p);
        static LX_Define::PaperFormat stringToPaperFormat(const QString& p);

	static void test();
};


#endif
